<?php
namespace App\Repositories\Main;

use App\Models\Main\CompanyCostModel;
use App\Repositories\BaseRepository;

class ComCostRepository extends BaseRepository
{
    protected $repository;

    public function __construct()
    {
        $this->repository = new CompanyCostModel();
    }

//    public function getIndex($dorderId)
//    {
//        return $this->repository->where('bale')
//            ->skip()->take()->get();;
//    }

    public function setAdd($data)
    {
        return $this->repository->insertGetId($data);
    }

    public function setModify($data,$id)
    {
        return $this->repository->where('id',$id)
            ->update($data);
    }

    public function setModifyByUid($data,$uid)
    {
        return $this->repository->where('uid',$uid)
            ->update($data);
    }

    public function getShowOne($id)
    {
        return $this->repository->where('id',$id)->first();
    }

    public function getShowByUid($uid)
    {
        return $this->repository->where('uid',$uid)->get();
    }

    public function getShowByType($uid,$type)
    {
        return $this->repository
            ->where('uid',$uid)
            ->where('type',$type)
            ->get();
    }
}